﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Export.ascx.cs" Inherits="ERP.Modules.Export" %>
<%-------------------------------%>
<script>
    var editExport = function (editor, e) {
        if (e.record.data.Export_Detail_Quality_Insert > e.record.data.SumMaterials) {
            Ext.Msg.alert("Lỗi", "Kho không đủ số lượng, Vui lòng nhập lại!");
            e.record.reject();
        };
        if (e.record.data.Export_Detail_Quality_Insert > e.record.data.Export_Detail_Quality_Still) {
            Ext.Msg.alert("Lỗi", "Số lượng xuất phải nhỏ hơn số lượng còn lại!");
            e.record.reject();
        };
    };
</script>
<ext:Hidden ID="FormatTypeExport" runat="server" />
<%--------------GridExport-----------------%>
<ext:Panel ID="PanelExport" runat="server" Layout="Fit" Border="False">
    <Content>
        <ext:GridPanel
            ID="grExport"
            runat="server"
            Cls="grid-double"
            EnableColumnMove="true"
            Border="False">
            <Store>
                <ext:Store
                    ID="StoreExport"
                    runat="server"
                    OnReadData="StoreExport_RefreshData"
                    PageSize="20">
                    <Model>
                        <ext:Model ID="ModelExport" runat="server" IDProperty="Export_ID" GroupField="Room_Name">
                            <Fields>
                                <ext:ModelField Name="Export_No" Type="String" />
                                <ext:ModelField Name="Export_Date" Type="Date" />
                                <ext:ModelField Name="Export_Purcharse" Type="String" />
                                <ext:ModelField Name="Proposed_Export_No" Type="String" />
                                <ext:ModelField Name="Room_Name" Type="String" />
                                <ext:ModelField Name="WH_Branch" Type="String" />
                                <ext:ModelField Name="Export_Note" Type="String" />
                                <ext:ModelField Name="Export_Test" Type="String" />
                            </Fields>
                        </ext:Model>
                    </Model>
                </ext:Store>
            </Store>
            <ColumnModel runat="server">
                <Columns>
                    <ext:RowNumbererColumn ID="RowNumbererColumn1" runat="server" Width="30" Align="Center" />
                    <ext:Column ID="Column1" runat="server" Text="Kho" Width="150" DataIndex="WH_Branch"></ext:Column>
                    <ext:Column ID="Column2" runat="server" Text="Phòng chứa" Width="90" DataIndex="Room_Name"></ext:Column>
                    <ext:Column ID="Column4" runat="server" Text="Mã phiếu xuất" Width="100" DataIndex="Export_No"></ext:Column>
                    <ext:DateColumn ID="Column5" runat="server" Text="Ngày xuất" Width="80" DataIndex="Export_Date" Format="dd-MM-yyyy"></ext:DateColumn>
                    <ext:Column ID="Column3" runat="server" Text="Chứng từ" Width="90" DataIndex="Proposed_Export_No"></ext:Column>
                    <ext:Column ID="Column13" runat="server" Text="Người giao" Width="100" DataIndex="Export_Purcharse"></ext:Column>
                    <ext:Column ID="Column6" runat="server" Text="Người kiểm tra" Width="100" DataIndex="Export_Test"></ext:Column>
                    <ext:Column ID="Column7" runat="server" Text="Ghi chú" Width="100" DataIndex="Export_Note" Flex="1"></ext:Column>
                </Columns>
            </ColumnModel>
            <Features>
                <ext:Grouping ID="Grouping1"
                    runat="server"
                    HideGroupedHeader="true"
                    GroupByText="Xem theo phân nhóm"
                    ShowGroupsText="Phân nhóm"
                    GroupHeaderTplString="{name} ({rows.length} danh mục con {[values.rows.length > 1 ? '' : '']})"
                    StartCollapsed="True" />
            </Features>
            <DirectEvents>
                <ItemDblClick OnEvent="ExportDblClick">
                    <ExtraParams>
                        <ext:Parameter Name="Export_ID" Value="record.data.Export_ID" Mode="Raw" />
                    </ExtraParams>
                    <EventMask ShowMask="true" Msg="Đang tải..." />
                </ItemDblClick>
            </DirectEvents>
            <SelectionModel>
                <ext:CheckboxSelectionModel ID="CheckboxSelectionModelExport" runat="server" Mode="Multi">
                    <DirectEvents>
                        <Select OnEvent="Cell_Click">
                            <EventMask ShowMask="false" Msg="Đang tải..." />
                        </Select>
                    </DirectEvents>
                </ext:CheckboxSelectionModel>
            </SelectionModel>
            <View>
                <ext:GridView ID="GridView1" runat="server" StripeRows="true" />
            </View>
            <DockedItems>
                <ext:Toolbar ID="ToolbarTopMain" runat="server" Dock="Top">
                    <Items>
                        <ext:Button ID="btnAddNew" runat="server" Text="Thêm mới" Icon="ApplicationAdd">
                            <DirectEvents>
                                <Click OnEvent="btnAddNew_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                        <ext:ToolbarSeparator />
                        <ext:Button ID="btnEdit" runat="server" Text="Sửa" Icon="ApplicationEdit">
                            <DirectEvents>
                                <Click OnEvent="btnEdit_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                        <ext:ToolbarSeparator />
                        <ext:Button ID="btnDel" runat="server" Text="Xoá" Icon="ApplicationDelete">
                            <DirectEvents>
                                <Click OnEvent="btnDel_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                    <ExtraParams>
                                        <ext:Parameter Name="name" Value="btnDel"></ext:Parameter>
                                    </ExtraParams>
                                    <Confirmation ConfirmRequest="true"
                                        Title="Thông Báo" Message="Bạn có muốn xoá mẫu tin này không ?">
                                    </Confirmation>
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                        <ext:ToolbarSeparator />
                        <ext:Button ID="btnExport" runat="server" Text="Xuất tập tin" Icon="Printer">
                            <Menu>
                                <ext:Menu ID="MenuMain" runat="server">
                                    <Items>
                                        <ext:MenuItem ID="MenuItemExportXML" runat="server" Text="XML" Icon="PageCode">
                                            <Listeners>
                                                <Click Handler="submitValue(#{grExport}, #{FormatTypeExport}, 'xml');" />
                                            </Listeners>
                                        </ext:MenuItem>
                                    </Items>
                                </ext:Menu>
                            </Menu>
                        </ext:Button>
                        <ext:ToolbarSeparator />
                        <ext:DateField ID="txtDateBeginFillter" EmptyText="Từ ngày" runat="server" MarginSpec="0 8 0 0" />
                        <ext:DateField ID="txtDateEndFillter" EmptyText="Đến ngày" runat="server" MarginSpec="0 5 0 0" />
                        <ext:Button ID="btnFillter" runat="server" Text="Lọc" Icon="ApplicationGo" ToolTip="Chọn lọc theo ngày đặt hàng">
                            <DirectEvents>
                                <Click OnEvent="btnFillter_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                    </Items>
                </ext:Toolbar>
                <ext:Toolbar ID="ToolbarPagging" runat="server" Dock="Bottom" AnchorHorizontal="100%">
                    <Items>
                        <ext:TriggerField ID="txtSearch" runat="server" Width="200" EnableKeyEvents="true" MarginSpec="0 8 0 0">
                            <Triggers>
                                <ext:FieldTrigger Icon="Search" />
                            </Triggers>
                            <DirectEvents>
                                <TriggerClick OnEvent="Search_Event"></TriggerClick>
                                <KeyPress OnEvent="Search_Event"></KeyPress>
                            </DirectEvents>
                        </ext:TriggerField>
                        <ext:SelectBox
                            ID="SelectBoxExportWarrehouse"
                            runat="server"
                            Cls="x-select-box"
                            DisplayField="Warehouse_Name"
                            ValueField="Warehouse_Id"
                            MarginSpec="0 8 0 0"
                            EmptyText="Chọn kho">
                            <Store>
                                <ext:Store ID="StoreExportWarrehouse" runat="server">
                                    <Model>
                                        <ext:Model ID="Model1" runat="server">
                                            <Fields>
                                                <ext:ModelField Name="Warehouse_Name" />
                                                <ext:ModelField Name="Warehouse_Id" />
                                            </Fields>
                                        </ext:Model>
                                    </Model>
                                </ext:Store>
                            </Store>
                            <DirectEvents>
                                <Select OnEvent="SelectBoxExportWarrehouse_Change">
                                    <EventMask ShowMask="true" Msg="Đang tải..."></EventMask>
                                </Select>
                            </DirectEvents>
                        </ext:SelectBox>
                        <ext:SelectBox
                            ID="SelectBoxExportRoom"
                            runat="server"
                            Cls="x-select-box"
                            DisplayField="Room_Name"
                            ValueField="Room_Id"
                            MarginSpec="0 8 0 0"
                            EmptyText="Chọn phòng chứa">
                            <Store>
                                <ext:Store ID="StoreExportRoom" runat="server">
                                    <Model>
                                        <ext:Model ID="Model2" runat="server">
                                            <Fields>
                                                <ext:ModelField Name="Room_Name" />
                                                <ext:ModelField Name="Room_Id" />
                                            </Fields>
                                        </ext:Model>
                                    </Model>
                                </ext:Store>
                            </Store>
                            <DirectEvents>
                                <Select OnEvent="SelectBoxExportRoom_Change">
                                    <EventMask ShowMask="true" Msg="Đang tải..."></EventMask>
                                </Select>
                            </DirectEvents>
                        </ext:SelectBox>
                        <ext:PagingToolbar ID="PagingToolbarExport" runat="server" StoreID="StoreExport" BeforePageText="Trang" AfterPageText="của {0}" LastText="Cuối" NextText="Kế tiếp" PrevText="Trở lại" FirstText="Đầu" RefreshText="Làm tươi" DisplayInfo="true" DisplayMsg="Trang {0} - {1} của {2}" />
                    </Items>
                </ext:Toolbar>
            </DockedItems>
        </ext:GridPanel>
    </Content>
</ext:Panel>
<ext:Panel ID="Panel1" runat="server">
    <Content>
        <%-----------WindowsExport-----------------%>
        <ext:Window ID="WindowsExport" runat="server"
            Title="Cập nhật xuất kho"
            Width="832px"
            Height="531px"
            Hidden="true"
            Region="Center"
            Modal="true"
            HideMode="Display"
            Border="false"
            Padding="5"
            DefaultButton="btnSavePopUp"
            Resizable="False">
            <Items>
                <ext:Toolbar ID="ToolbarExport" runat="server">
                    <Items>
                        <ext:Button runat="server" Text="Lưu lại" Icon="Disk" ID="btnSavePopUp">
                            <DirectEvents>
                                <Click OnEvent="btnSavePopUp_Click" Before="return #{FormPanelExport}.isValid();">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                    <ExtraParams>
                                        <ext:Parameter Name="grExport_Detail" Value="Ext.encode(#{grExport_Detail}.getRowsValues({selectedOnly : false}))" Mode="Raw" />
                                    </ExtraParams>
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                        <ext:Button runat="server" Text="Huỷ bỏ" Icon="Decline" ID="btnCancelPopUp">
                            <DirectEvents>
                                <Click OnEvent="btnCancelPopUp_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                        <ext:TextField ID="txtExport_ID" runat="server" FieldLabel="ID" LabelAlign="Right" Hidden="true" />
                    </Items>
                </ext:Toolbar>
                <ext:FormPanel ID="FormPanelExport" runat="server"
                    AutoHeight="true"
                    BodyPadding="10"
                    Frame="true">
                    <Items>
                        <ext:FieldContainer ID="FieldContainer1"
                            runat="server"
                            AnchorHorizontal="100%"
                            Layout="HBoxLayout">
                            <Items>
                                <ext:ComboBox
                                    ID="cbBranch"
                                    runat="server"
                                    QueryMode="Local"
                                    ForceSelection="true"
                                    SelectOnFocus="True"
                                    TypeAhead="True"
                                    FieldLabel="Chi nhánh" Width="223"
                                    DisplayField="TENCHINHANH"
                                    ValueField="STT"
                                    EmptyText="Vui lòng chọn chi nhánh"
                                    Margins="0 5 0 0"
                                    ContextMenuID="cbBranchContext">
                                    <Listeners>
                                        <Select Handler="#{cbWareHouse}.clearValue(); #{WarehouseStore}.reload();"></Select>
                                    </Listeners>
                                    <Store>
                                        <ext:Store runat="server" ID="BranchStore" OnReadData="ReloadComboBox">
                                            <Model>
                                                <ext:Model ID="BranchModel" runat="server" IDProperty="STT">
                                                    <Fields>
                                                        <ext:ModelField Name="MACHINHANH" Type="String" />
                                                        <ext:ModelField Name="TENCHINHANH" Type="String" />
                                                    </Fields>
                                                </ext:Model>
                                            </Model>
                                        </ext:Store>
                                    </Store>
                                </ext:ComboBox>
                                <ext:Button ID="Button1" runat="server" Icon="Add" Margins="0 20 0 0">
                                    <Listeners>
                                        <Click Handler="#{WindowsBranch}.show();"></Click>
                                    </Listeners>
                                    <ToolTips>
                                        <ext:ToolTip ID="ToolTip1" runat="server" Html="Thêm mới chi nhánh" />
                                    </ToolTips>
                                </ext:Button>
                                <ext:ComboBox
                                    ID="cbWarehouse"
                                    runat="server"
                                    QueryMode="Local"
                                    SelectOnFocus="true"
                                    ForceSelection="true"
                                    ReadOnly="True"
                                    FieldLabel="Kho" Width="223"
                                    DisplayField="Warehouse_Name"
                                    ValueField="Warehouse_Id"
                                    EmptyText="Vui lòng chọn kho"
                                    Margins="0 5 0 0"
                                    AllowBlank="false"
                                    ContextMenuID="cbWarehouseContext">
                                    <Listeners>
                                        <Select Handler="#{cbRoom}.clearValue(); #{RoomStore}.reload();"></Select>
                                    </Listeners>
                                    <Store>
                                        <ext:Store runat="server" ID="WarehouseStore" AutoLoad="true" OnReadData="BranchSelectIndex_Change">
                                            <Model>
                                                <ext:Model ID="WareHouseModel" runat="server" IDProperty="Warehouse_Id">
                                                    <Fields>
                                                        <ext:ModelField Name="Warehouse_Alias" Type="String" />
                                                        <ext:ModelField Name="Warehouse_Name" Type="String" />
                                                    </Fields>
                                                </ext:Model>
                                            </Model>
                                        </ext:Store>
                                    </Store>
                                </ext:ComboBox>
                                <ext:Button ID="Button2" runat="server" Icon="Add" Margins="0 20 0 0">
                                    <Listeners>
                                        <Click Handler="#{WindowsWarehouse}.show();"></Click>
                                    </Listeners>
                                    <ToolTips>
                                        <ext:ToolTip ID="ToolTip2" runat="server" Html="Thêm mới kho" />
                                    </ToolTips>
                                </ext:Button>
                                <ext:ComboBox runat="server"
                                    ID="cbRoom"
                                    FieldLabel="Phòng chứa:" Width="223"
                                    DisplayField="Room_Name"
                                    ValueField="Room_Id"
                                    QueryMode="Local"
                                    ForceSelection="true"
                                    SelectOnFocus="True"
                                    ReadOnly="True"
                                    TypeAhead="True"
                                    EmptyText="Chọn mã phòng chứa"
                                    Margins="0 5 0 0"
                                    ContextMenuID="cbRoomContext">
                                    <Store>
                                        <ext:Store runat="server" ID="RoomStore" AutoLoad="true" OnReadData="WarehouseSelectIndex_Change">
                                            <Model>
                                                <ext:Model ID="Model3" runat="server" IDProperty="Room_Id">
                                                    <Fields>
                                                        <ext:ModelField Name="Room_Name" Type="String" />
                                                    </Fields>
                                                </ext:Model>
                                            </Model>
                                        </ext:Store>
                                    </Store>
                                    <DirectEvents>
                                        <Select OnEvent="cbRoomSelectIndex_Change">
                                            <EventMask ShowMask="true" Msg="Đang tải..."></EventMask>
                                        </Select>
                                    </DirectEvents>
                                </ext:ComboBox>
                                <ext:Button ID="Button3" runat="server" Icon="Add" Margins="0 20 0 0">
                                    <Listeners>
                                        <Click Handler="#{WindowsRoom}.show();"></Click>
                                    </Listeners>
                                    <ToolTips>
                                        <ext:ToolTip ID="ToolTip3" runat="server" Html="Thêm mới phòng chứa" />
                                    </ToolTips>
                                </ext:Button>
                            </Items>
                        </ext:FieldContainer>
                        <ext:FieldContainer ID="FieldContainer2"
                            runat="server"
                            AnchorHorizontal="100%"
                            Layout="HBoxLayout">
                            <Items>
                                <ext:TextField ID="txtExport_No" runat="server" FieldLabel="Mã phiếu xuất:" Width="250" Margins="0 20 0 0" />
                                <ext:DateField ID="txtExport_Date" runat="server" FieldLabel="Ngày xuất:" Width="250" Margins="0 20 0 0" />
                                <ext:TriggerField ID="txtExport_Invoice" runat="server" FieldLabel="Chứng từ đề nghị" AllowBlank="False" Width="250">
                                    <Triggers>
                                        <ext:FieldTrigger Icon="SimpleGet" />
                                    </Triggers>
                                    <ToolTips>
                                        <ext:ToolTip ID="ToolTip4"
                                            runat="server"
                                            Html="Chọn vật tư từ phiếu đề nghị"
                                            AutoHide="true">
                                        </ext:ToolTip>
                                    </ToolTips>
                                    <DirectEvents>
                                        <TriggerClick OnEvent="btnAddExportMaterials_Click">
                                            <EventMask ShowMask="true" Msg="Đang tải..."></EventMask>
                                        </TriggerClick>
                                    </DirectEvents>
                                </ext:TriggerField>
                                <ext:Hidden runat="server" ID="txtProposed_Export_ID"></ext:Hidden>
                            </Items>
                        </ext:FieldContainer>
                        <ext:FieldContainer ID="FieldContainer6"
                            runat="server"
                            AnchorHorizontal="100%"
                            Layout="HBoxLayout">
                            <Items>
                                <ext:TextField ID="txtExport_Provider" runat="server" FieldLabel="Người giao:" AllowBlank="False" Width="250" Margins="0 20 0 0" />
                                <ext:TextField ID="txtExport_Test" runat="server" FieldLabel="Người kiểm tra:" AllowBlank="False" Width="250" Margins="0 20 0 0" />
                            </Items>
                        </ext:FieldContainer>
                        <ext:FieldContainer ID="FieldContainer4"
                            runat="server"
                            AnchorHorizontal="100%">
                            <Items>
                                <ext:GridPanel
                                    ID="grExport_Detail"
                                    Cls="grid-double"
                                    runat="server"
                                    EnableColumnMove="true"
                                    AutoWidth="true"
                                    AutoScroll="true"
                                    Layout="Fit"
                                    Height="300">
                                    <Store>
                                        <ext:Store
                                            ID="StoreExport_Detail"
                                            runat="server"
                                            OnReadData="StoreExport_Detail_RefreshData">
                                            <Model>
                                                <ext:Model ID="ModelExport_Detail" runat="server" IDProperty="Export_Detail_ID">
                                                    <Fields>
                                                        <ext:ModelField Name="Proposed_Export_ID" Type="Int" />
                                                        <ext:ModelField Name="Materials_ID" Type="Int" />
                                                        <ext:ModelField Name="Materials_Alias" Type="String" />
                                                        <ext:ModelField Name="Materials_Name" Type="String" />
                                                        <ext:ModelField Name="Unit_Name" Type="String" />
                                                        <ext:ModelField Name="Export_Detail_Quality_Voucher" Type="Int" />
                                                        <ext:ModelField Name="Export_Detail_Quality_HaveExport" Type="Int" />
                                                        <ext:ModelField Name="Export_Detail_Quality" Type="Int" />
                                                        <ext:ModelField Name="Export_Detail_Quality_Still" Type="Int" />
                                                        <ext:ModelField Name="Export_Detail_Quality_Insert" Type="Int" />
                                                        <ext:ModelField Name="Export_Detail_Price" Type="Float" />
                                                        <ext:ModelField Name="SumMaterials" Type="Float" />
                                                    </Fields>
                                                </ext:Model>
                                            </Model>
                                        </ext:Store>
                                    </Store>
                                    <ColumnModel runat="server">
                                        <Columns>
                                            <ext:RowNumbererColumn ID="RowNumbererColumn2" Text="STT" runat="server" Width="30" Align="Center" />
                                            <ext:Column ID="Column8" runat="server" Text="Mã hàng" Width="100" DataIndex="Materials_Alias" />
                                            <ext:Column ID="Column9" runat="server" Text="Tên hàng" Width="100" DataIndex="Materials_Name" />
                                            <ext:Column ID="Column17" runat="server" Text="SL trong kho" Width="100" DataIndex="SumMaterials" />
                                            <ext:Column ID="Column12" runat="server" Text="SL Xuất/CT" Width="80" DataIndex="Export_Detail_Quality_Voucher" />
                                            <ext:Column ID="Column26" runat="server" Text="SL còn (Chưa xuất)" Width="105" DataIndex="Export_Detail_Quality_Still" />
                                            <ext:Column ID="Column27" runat="server" Text="SL xuất" Width="50" DataIndex="Export_Detail_Quality_Insert">
                                                <Editor>
                                                    <ext:NumberField ID="NumberField1" runat="server" MinValue="0">
                                                    </ext:NumberField>
                                                </Editor>
                                            </ext:Column>
                                            <ext:Column ID="Column10" runat="server" Text="Đơn vị tính" Width="90" DataIndex="Unit_Name" />
                                            <ext:Column ID="Column11" runat="server" AllowBlank="false" MinValue="0" Text="Giá vốn" Width="90" DataIndex="Export_Detail_Price" Flex="1">
                                                <Renderer Fn="Ext.util.Format.numberRenderer('0,000')" />
                                            </ext:Column>
                                        </Columns>
                                    </ColumnModel>
                                    <Plugins>
                                        <ext:RowEditing ID="RowEditing1" runat="server" SaveBtnText="Cập nhật" CancelBtnText="Hủy bỏ">
                                            <DirectEvents>
                                                <Edit OnEvent="UpdateMaterials_Click">
                                                    <ExtraParams>
                                                        <ext:Parameter Name="Quotes_Materials" Value="Ext.encode(#{grExportMaterials}.getRowsValues({selectedOnly : true}))" Mode="Raw" />
                                                    </ExtraParams>
                                                </Edit>
                                            </DirectEvents>
                                            <Listeners>
                                                <Edit Fn="editExport"></Edit>
                                            </Listeners>
                                        </ext:RowEditing>
                                    </Plugins>
                                    <SelectionModel>
                                        <ext:CheckboxSelectionModel ID="CheckboxSelectionModel1" runat="server" Mode="Multi" />
                                    </SelectionModel>
                                </ext:GridPanel>
                            </Items>
                        </ext:FieldContainer>
                        <ext:TextArea ID="txtExport_Note" FieldLabel="Ghi chú" runat="server" AnchorHorizontal="100%" Height="50" />
                    </Items>
                </ext:FormPanel>
            </Items>
        </ext:Window>
        <%--------------Material-----------------%>
        <ext:Window ID="WindowExport_Proposed_Export_Materials" runat="server"
            Title="Thông tin vật tư"
            DefaultAnchor="100%"
            Width="829"
            Height="400"
            Hidden="true"
            AutoScroll="false"
            Maximizable="False"
            Minimizable="False"
            AutoDataBind="true"
            Region="Center"
            Resizable="False"
            Modal="true"
            Layout="Fit"
            HideMode="Offsets"
            Constrain="True">
            <Content>
                <ext:GridPanel
                    ID="grExport_Proposed_Export_Materials"
                    Border="True"
                    runat="server"
                    AutoWidth="true"
                    AutoScroll="true"
                    Cls="gird"
                    EnableColumnMove="true">
                    <Store>
                        <ext:Store
                            ID="StoreExport_Proposed_Export_Materials"
                            runat="server"
                            OnReadData="StoreExport_Proposed_Export_Materials_RefreshData"
                            PageSize="10">
                            <Model>
                                <ext:Model ID="Model4" runat="server" IDProperty="Materials_ID">
                                    <Fields>
                                        <ext:ModelField Name="Proposed_Export_ID" Type="Int" />
                                        <ext:ModelField Name="Sell_ID" Type="Int" />
                                        <ext:ModelField Name="Materials_ID" Type="String" />
                                        <ext:ModelField Name="Materials_Alias" Type="String" />
                                        <ext:ModelField Name="Materials_Name" Type="String" />
                                        <ext:ModelField Name="Unit_Name" Type="String" />
                                        <ext:ModelField Name="Proposed_Export_Quality" Type="Int" />
                                        <ext:ModelField Name="Proposed_Export_Quality_Still" Type="Int" />
                                        <ext:ModelField Name="Price_Initially" Type="Float" />
                                        <ext:ModelField Name="SumMaterials" Type="Int" />
                                    </Fields>
                                </ext:Model>
                            </Model>
                        </ext:Store>
                    </Store>
                    <ColumnModel runat="server">
                        <Columns>
                            <ext:RowNumbererColumn ID="Column16" runat="server" Text="STT" Width="35" Align="Center"></ext:RowNumbererColumn>
                            <ext:Column ID="Column14" runat="server" Text="Mã vật tư" Width="100" DataIndex="Materials_Alias" Align="Left"></ext:Column>
                            <ext:Column ID="Column19" runat="server" Text="Tên vật tư" Width="200" DataIndex="Materials_Name" Align="Left"></ext:Column>
                            <ext:Column ID="Column20" runat="server" Text="Số lượng xuất (CT)" Width="110" DataIndex="Proposed_Export_Quality" Align="Center"></ext:Column>
                            <ext:NumberColumn ID="NumberColumn1" runat="server" Text="Đơn giá" Width="150" DataIndex="Price_Initially" Format="0,00" Align="Center"></ext:NumberColumn>
                            <ext:Column ID="Column15" runat="server" Text="Đơn vị tính" Width="100" DataIndex="Unit_Name" Align="Left" Flex="1"></ext:Column>
                        </Columns>
                    </ColumnModel>
                    <SelectionModel>
                        <ext:CheckboxSelectionModel ID="CheckboxSelectionModel2" runat="server" Mode="Multi" />
                    </SelectionModel>
                    <TopBar>
                        <ext:Toolbar ID="Toolbar3" runat="server">
                            <Items>
                                <ext:ComboBox runat="server"
                                    ID="cbProposed_Export"
                                    Editable="false"
                                    SelectOnFocus="true"
                                    ForceSelection="True"
                                    FieldLabel="Phiếu đề nghị:" Width="250"
                                    DisplayField="Proposed_Export_No"
                                    ValueField="Proposed_Export_ID"
                                    EmptyText="Chọn phiếu đề nghị"
                                    Margins="0 20 0 0"
                                    AllowBlank="false"
                                    ContextMenuID="cbProposed_ExportContext">
                                    <Store>
                                        <ext:Store runat="server" ID="Proposed_ExportStore" OnReadData="ReloadComboBox">
                                            <Model>
                                                <ext:Model ID="Proposed_ExportModel" runat="server" IDProperty="Proposed_Export_ID">
                                                    <Fields>
                                                        <ext:ModelField Name="Proposed_Export_No" Type="String" />
                                                    </Fields>
                                                </ext:Model>
                                            </Model>
                                        </ext:Store>
                                    </Store>
                                    <DirectEvents>
                                        <Select OnEvent="cbProposed_ExportSelectIndex_Change">
                                            <EventMask ShowMask="true" Msg="Đang tải..."></EventMask>
                                        </Select>
                                    </DirectEvents>
                                </ext:ComboBox>
                                <ext:Button ID="btnSelectExport_Proposed_Export_Materials" runat="server" Text="Chọn vật tư" Icon="Accept" ToolTip="Chọn vật tư">
                                    <DirectEvents>
                                        <Click OnEvent="btnSelectExport_Proposed_Export_Materials_Click">
                                            <EventMask ShowMask="true" Msg="Đang tải..." />
                                            <ExtraParams>
                                                <ext:Parameter Name="grExport_Proposed_Export_Materials" Value="Ext.encode(#{grExport_Proposed_Export_Materials}.getRowsValues({selectedOnly : true}))" Mode="Raw" />
                                                <ext:Parameter Name="grExport_Detail" Value="Ext.encode(#{grExport_Detail}.getRowsValues({selectedOnly : false}))" Mode="Raw" />
                                            </ExtraParams>
                                        </Click>
                                    </DirectEvents>
                                </ext:Button>
                            </Items>
                        </ext:Toolbar>
                    </TopBar>
                    <DockedItems>
                        <ext:Toolbar ID="ToolBarExport_Proposed_Export_Materials" runat="server" Dock="Bottom" AnchorHorizontal="100%">
                            <Items>
                                <ext:PagingToolbar ID="PagingToolbar4" runat="server" StoreID="StoreExport_Proposed_Export_Materials" BeforePageText="Trang" AfterPageText="của {0}" LastText="Cuối" NextText="Kế tiếp" PrevText="Trở lại" FirstText="Đầu" RefreshText="Làm tươi" DisplayInfo="true" DisplayMsg="Trang {0} - {1} của {2}" />
                            </Items>
                        </ext:Toolbar>
                    </DockedItems>
                </ext:GridPanel>
            </Content>
        </ext:Window>
        <ext:Menu runat="server" ID="cbBranchContext">
            <Items>
                <ext:Button ID="Button4" runat="server" Text="Thêm mới" Icon="ApplicationAdd" Flat="True">
                    <Listeners>
                        <Click Handler="#{WindowsBranch}.show();"></Click>
                    </Listeners>
                </ext:Button>
                <ext:Button ID="Button5" runat="server" Text="Tải lại" Icon="DatabaseRefresh" Flat="True">
                    <Listeners>
                        <Click Handler="#{cbBranch}.clearValue(); #{BranchStore}.reload(); #{cbWarehouse}.setReadOnly(true); #{cbWarehouse}.clearValue();#{cbRoom}.setReadOnly(true); #{cbRoom}.clearValue(); #{cbBranchContext}.hide();"></Click>
                    </Listeners>
                </ext:Button>
            </Items>
        </ext:Menu>
        <ext:Menu runat="server" ID="cbWarehouseContext">
            <Items>
                <ext:Button ID="Button6" runat="server" Text="Tải lại" Icon="DatabaseRefresh" Flat="True">
                    <Listeners>
                        <Click Handler="#{cbWarehouse}.clearValue(); #{WarehouseStore}.reload();#{cbRoom}.setReadOnly(true); #{cbRoom}.clearValue(); #{cbWarehouseContext}.hide();"></Click>
                    </Listeners>
                </ext:Button>
            </Items>
        </ext:Menu>
        <ext:Menu runat="server" ID="cbRoomContext">
            <Items>
                <ext:Button ID="Button8" runat="server" Text="Tải lại" Icon="DatabaseRefresh" Flat="True">
                    <Listeners>
                        <Click Handler="#{cbRoom}.clearValue(); #{RoomStore}.reload(); #{cbRoomContext}.hide();"></Click>
                    </Listeners>
                </ext:Button>
            </Items>
        </ext:Menu>
        <ext:Menu runat="server" ID="cbProposed_ExportContext">
            <Items>
                <ext:Button ID="Button7" runat="server" Text="Tải lại" Icon="DatabaseRefresh" Flat="True">
                    <Listeners>
                        <Click Handler="#{cbProposed_Export}.clearValue(); #{Proposed_ExportStore}.reload(); #{cbProposed_ExportContext}.hide(); #{StoreExport_Proposed_Export_Materials}.reload();"></Click>
                    </Listeners>
                </ext:Button>
            </Items>
        </ext:Menu>
    </Content>
</ext:Panel>
